<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'reg.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
    <script language="javascript">
	  function keyLogin(){
	      if(event.keyCode==13)
	         document.getElementByName("Submit").click();
	  }
	  </script>
	  
	  
	      <script type="text/javascript">   
    function check()   
    {   //var username=document.all.username.value;//获取用户名所填的内容
	  //var passwd= document.all.passwd.value;//获取所填的密码
	  //var repasswd= document.all.repasswd.value;//获取所填的确认密码
      if(form1.username.value.length<=0)
      {
       alert("用户名不能为空！！");
       return false;
       }
       if(form1.username.value.indexOf(" ")!=-1){
            alert("用户名不能出现空格！！");
            return false;
        }
         if(form1.passwd.value.length<=0){
            alert("密码不能为空！！");
            return false;
        }
         if(form1.passwd.value.length<5&&form1.passwd.value.length>0){
            alert("密码长度不能小于5位！！");
            return false;
        }
        if(form1.passwd.value.indexOf(" ")!=-1){
            alert("密码不能有空格！！");
            return false;
        }
        if(form1.repasswd.value.length<=0){
            alert("确认密码不能为空！！");
            return false;
         }
         if(form1.repasswd.value!=form1.passwd.value){
            alert("两次输入密码不一致！！");
            return false;
        }
    }
     </script>
	  
	  
	  <script language=”javascript“>
	  function check(){
	  //var username=document.all.username.value;//获取用户名所填的内容
	  //var passwd= document.all.passwd.value;//获取所填的密码
	  //var repasswd= document.all.repasswd.value;//获取所填的确认密码
      if(form1.username.value.length<=0)
      {
       alert("用户名不能为空！！");
       return false;
       }
       if(form1.username.value.indexOf(" ")!=-1){
            alert("用户名不能出现空格");
            return false;
        }
         if(form1.passwd.value.length<=0){
            alert("密码不能为空");
            return false;
        }
         if(form1.passwd.value.length<5&&form1.passwd.value.length>0){
            alert("密码长度不能小于5位");
            return false;
        }
        if(form1.passwd.value.indexOf(" ")!=-1){
            alert("密码不能有空格");
            return false;
        }
        if(form1.repasswd.value.length<=0){
            alert("确认密码不能为空");
            return false;
         }
         if(form1.repasswd.value!=form1.passwd.value){
            alert("两次输入密码不一致");
            return false;
        }
     }
	   </script>
	   
 <script type="text/javascript" >
  function chkpwd(obj){
   var t=obj.value;
   var id=getResult(t);
   //定义对应的消息提示
   var msg=new Array(4);
   msg[0]="密码太短";
   msg[1]="密码强度比较差";
   msg[2]="密码强度一般";
   msg[3]="密码强度高";
   
   var sty=new Array(4);
   
   sty[0]=-45;
   sty[1]=-30;
   sty[2]=-15;
   sty[3]=0;
   //消息提示对应的颜色
   var col=new Array(4);
   col[0]="gray";
   col[1]="red";
   col[2]="#ff6600";
   col[3]="Green";
   
   //设置显示效果
   var sWidth=300;
   var sHeight=15;
   var Bobj=document.getElementById("chkResult");
   Bobj.style.fontSize="12px";
   Bobj.style.color=col[id];
   Bobj.style.width=sWidth + "px";
   Bobj.style.height=sHeight + "px";
   Bobj.style.lineHeight=sHeight + "px";
   Bobj.style.textIndent="20px";
   Bobj.innerHTML="密码检测提示：" + msg[id];
   }
   //定义检测函数，返回0/1/2/3分别代表无效/差/一般/强
   function getResult(s){
   if(s.length < 4){
   return 0;
   }
   var ls = 0;
   if (s.match(/[a-z]/ig)){ls++;}
   if (s.match(/[0-9]/ig)){ls++;}
   if (s.match(/(.[^a-z0-9])/ig)){ls++;}
   if (s.length < 6 && ls > 0){ls--;}
   return ls;
   }
   </script>
  </head>
  
  <body  onkeydown="keyLogin();">
   <div align=center><font size="4"><strong>用户信息修改 </strong></font></div>
    <br>          
          <form name="form1" onsubmit="return check()" method="post" action="reset_result.jsp">
          <table width="400" border="0" cellspacing="1" cellpadding="1" align="center">
          <br>
            <tr> 
              <td align="right">用户名：</td>
              <td> 
                <input type="text" name="username" size="15" maxlength="25"><br>
              </td>
            </tr>
            <tr> 
              <td align="right">新用户名：</td>
              <td> 
                <input type="text" name="reusername" size="15" maxlength="25"><br>
              </td>
            </tr>
            <tr> 
              <td align="right">密&nbsp;&nbsp;码：</td>
              <td> 
                <input type="password" name="passwd" size="15" maxlength="20">
              </td>
            </tr>
            <div id="chkResult"></div>
            <tr> 
              <td align="right">新密码：</td>
              <td> 
                <input type="password" name="repasswd" size="15" maxlength="20">
              </td>
            </tr>
            <tr> 
              <td colspan="2" align="center"> 
                <input type="submit" name="Submit" value="修改">
                <a>&nbsp; &nbsp;</a>
                <input type="reset" name="Submit2" value="重置">
              </td>
            </tr>
            </table>
            </form>
 
  </body>
</html>

